<?php

class myBasket{
	
	static $instances = false;

	const SHIPPING_PRICE = 1;
	const TOTAL_NO_SHIPPING = 2;
	const TOTAL_PAYABLE = 3;

	const SESSION_BASED = 1;
	const CHECKED_OUT = 2;

	private function __construct(){}
	
	static function getInstance($type, $params = array()){
		if(!isset(self::$instances[$type])){
			switch($type){
				case self::SESSION_BASED:
					self::$instances[$type] = new BasketSessionBased($params);
					break;
				case self::CHECKED_OUT:
					self::$instances[$type] = new BasketCheckedOut($params);
					break;
				default:
					throw new Exception('wrong basket type');
					break;
			}
		}
		return self::$instances[$type];
	}
	
		
}